<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function dog(name, sex) {
        let obj = {};
        obj.name = name;
        obj.sex = sex;
        obj.talk = function () {
          console.log("叫");
        };
        return obj;
      }
      let dog1 = dog("大黄", "公");
      //   console.log(dog1);
      dog1.talk();
      let dog2 = dog("小黑", "公");
      setInterval(() => {
        dog2.talk();
      }, 1000);
    </script>
  </body>
</html>
